package com.sxj.springsourcecode.springframework.context.support;

import com.sxj.springsourcecode.springframework.factory.support.ConfigurableListableBeanFactory;
import com.sxj.springsourcecode.springframework.io.config.Resource;
import com.sxj.springsourcecode.springframework.io.support.XmlBeanDefinitionReader;

/**
 * @ProjectName: spring-source-code
 * @Package: com.sxj.springsourcecode.springframework.context.support
 * @ClassName: AbstractXmlApplicationContext
 * @Author: sxj
 * @Description:
 * @Date: 2024/2/21 23:45
 * @Version: 1.0.0
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshApplicationContext{
    @Override
    void loadBeanDefinitions(ConfigurableListableBeanFactory beanFactory) {
        //1 获取资源
        String configuration = getConfiguration();
        Resource resource = getResource(configuration);
        //2 加载bean定义
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
        reader.loadBeanDefinitions(resource);
    }

    /**
     * 获取配置信息
     *
     */
    public abstract String getConfiguration();
}
